<?php

namespace Kollway\CodeGenerator\Commands;

use Kollway\CodeGenerator\Generators\FormViewGenerator;
use Kollway\CodeGenerator\Generators\GeneratorTrait;

class CreateFormViewCommand extends BaseCommand
{
    use GeneratorTrait;

    public $signature = "cf {--table=} {--file=}";

    public $description = "生成表单视图文件";

    /** @throws \Throwable */
    public function handle()
    {
        $this->getTableAndOption($table, $option);

        $model_generator = new FormViewGenerator($table, $option);
        $model_generator->generateFormViewString();
        $model_generator->writeToFile();
    }
}